'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	
	if(event.method == 'get_monsters'){
		let monsters = await db.collection('monster').get();
		return {
			errcode : 0,
			data : monsters.data,
			msg : '获取怪物数据成功'
		}
	}
	//返回数据给客户端
	return event
};
